disabled. Handlers must take special care if necessary.
Fixes the debug 'd' key.
Signed-off-by: Keir Fraser <keir@xensource.com>
if ( unlikely(!guest_mode(regs)) )
{
struct bug_frame bug;
- if ( (__copy_from_user(&bug, (char *)regs->eip, sizeof(bug)) == 0) &&
+ if ( is_kernel(regs->eip) &&
+ (__copy_from_user(&bug, (char *)regs->eip, sizeof(bug)) == 0) &&
(memcmp(bug.ud2, "\xf\xb", sizeof(bug.ud2)) == 0) &&
(memcmp(bug.mov, BUG_MOV_STR, sizeof(bug.mov)) == 0) &&
(bug.ret == 0xc2) )
return 0;
}
+ ASSERT(!in_irq());
+ ASSERT(regs->eflags & X86_EFLAGS_IF);
+
if ( VM_ASSIST(d, VMASST_TYPE_writable_pagetables) &&
guest_kernel_mode(v, regs) &&
/* Do not check if access-protection fault since the page may
unsigned long addr, fixup;
int rc;
- ASSERT(!in_irq());
-
addr = read_cr2();
DEBUGGER_trap_entry(TRAP_page_fault, regs);
asmlinkage int math_state_restore(struct cpu_user_regs *regs)
{
+ BUG_ON(!guest_mode(regs));
+
setup_fpu(current);
if ( current->arch.guest_context.ctrlreg[0] & X86_CR0_TS )
testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%esp)
jz exception_with_ints_disabled
sti # re-enable interrupts
- xorl %eax,%eax
+1: xorl %eax,%eax
movw UREGS_entry_vector(%esp),%ax
movl %esp,%edx
pushl %edx # push the cpu_user_regs pointer
call search_pre_exception_table
addl $4,%esp
testl %eax,%eax # no fixup code for faulting EIP?
- jz FATAL_exception_with_ints_disabled
+ jz 1b
movl %eax,UREGS_eip(%esp)
movl %esp,%esi
subl $4,%esp
testb $X86_EFLAGS_IF>>8,UREGS_eflags+1(%rsp)
jz exception_with_ints_disabled
sti
- movq %rsp,%rdi
+1: movq %rsp,%rdi
movl UREGS_entry_vector(%rsp),%eax
leaq exception_table(%rip),%rdx
GET_CURRENT(%rbx)
movq %rsp,%rdi
call search_pre_exception_table
testq %rax,%rax # no fixup code for faulting EIP?
- jz FATAL_exception_with_ints_disabled
+ jz 1b
movq %rax,UREGS_rip(%rsp)
subq $8,UREGS_rsp(%rsp) # add ec/ev to previous stack frame
testb $15,UREGS_rsp(%rsp) # return %rsp is now aligned?